package com.entity;

import com.util.LocalInformation;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * Created by wlc on 2018/4/12.
 */
public class Experiment {
    /**
     * 静态属性
     */
    private Date date;
    private ArrayList<String> experiment_User_AND_Method;
    private ArrayList<String> experiment_RawMaterial;
    private ArrayList<String> experiment_Characterization;
    private ArrayList<String> experiment_Biological_evaluation;

    /**
     * 动态属性
     */

    public Experiment(){
        date = new Date();
    }

    public Experiment(ArrayList<String> experiment_User_AND_Method, ArrayList<String> experiment_RawMaterial, ArrayList<String> experiment_Characterization, ArrayList<String> experiment_Biological_evaluation) {
        this.experiment_User_AND_Method = experiment_User_AND_Method;
        this.experiment_RawMaterial = experiment_RawMaterial;
        this.experiment_Characterization = experiment_Characterization;
        this.experiment_Biological_evaluation = experiment_Biological_evaluation;
    }

    /**
     *数据成员设置和获取函数
     */
    public Date getDate(){
        return this.date;
    }

    public void setExperiment_User_AND_Method(String part1){
        ArrayList<String> temp_experiment_User_AND_Method = new ArrayList<>(Arrays.asList(part1.split("wlcniubi")));
        int[] time= LocalInformation.getNowDate(date);
        temp_experiment_User_AND_Method.add(2, time[0] + "-" + time[1] + "-" + time[2]);
        experiment_User_AND_Method = temp_experiment_User_AND_Method;
    }

    public ArrayList<String> getExperiment_User_AND_Method(){
        return this.experiment_User_AND_Method;
    }

    public void setExperiment_RawMaterial(String part2){
        ArrayList<String> temp_experiment_RawMaterial = new ArrayList<String>(Arrays.asList(part2.split("wlcniubi")));;
        temp_experiment_RawMaterial.add(0,experiment_User_AND_Method.get(0));
        experiment_RawMaterial = temp_experiment_RawMaterial;
    }

    public ArrayList<String> getExperiment_RawMaterial(){
        return this.experiment_RawMaterial;
    }

    public void setExperiment_Characterization(String part3,String sem_path,String stm_path){
        ArrayList<String> temp_experiment_Characterization = new ArrayList<>(Arrays.asList(part3.split("wlcniubi")));
        temp_experiment_Characterization.add(1,sem_path);
        temp_experiment_Characterization.add(2,stm_path);
        temp_experiment_Characterization.add(0,experiment_User_AND_Method.get(0));
        experiment_Characterization = temp_experiment_Characterization;
    }

    public ArrayList<String> getExperiment_Characterization(){
        return this.experiment_Characterization;
    }

    public void  setExperiment_Biological_evaluation(String part4){
        ArrayList<String> temp_experiment_Biological_evaluation = new ArrayList<>();
        String[] EBE_str = part4.split("wlcniubi");

        for (int i = 0; i < EBE_str.length-4; i++){
            temp_experiment_Biological_evaluation.add(EBE_str[i]);
        }
        temp_experiment_Biological_evaluation.add(4,EBE_str[EBE_str.length-4]);
        temp_experiment_Biological_evaluation.add(10,EBE_str[EBE_str.length-3]);
        temp_experiment_Biological_evaluation.add(14,EBE_str[EBE_str.length-2]);
        temp_experiment_Biological_evaluation.add(EBE_str[EBE_str.length-1]);

        temp_experiment_Biological_evaluation.add(0,experiment_User_AND_Method.get(0));
        experiment_Biological_evaluation = temp_experiment_Biological_evaluation;
    }

    public ArrayList<String> getExperiment_Biological_evaluation(){
        return this.experiment_Biological_evaluation;
    }
}
